package com.sunshine.androidjavapractise.service;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;

import java.util.Random;

/**
 * this service is used to play song
 */
public class LocalService extends Service {
    private final Random mRandom = new Random();
    private final IBinder mBinder = new LocalBinder();

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    public class LocalBinder extends Binder {
        LocalService getService() {
            return LocalService.this;
        }
    }

    public int getRandomNumber() {
        return mRandom.nextInt(100);
    }
}
